<template>
	<view class="page"
		:style="{ background: `url(${backimg}) no-repeat` }">
		<!---flex布局flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout sexRegister_flex_0">
			<view class='flex flex-direction flex-wrap align-center'>
				<benben-select-diy ref="showSelectPopup1686823307313"
					class-name='flex flex-direction align-stretch flex' :items.sync="sextype" v-model="sexid"
					default-type="value" default-label="name" :allow-cancel='false' type="radio" :disabled='false'>
					<template v-for='(item,key0) in sextype'>
						<view v-if="item.isSelected" class='flex flex' :key="key0"
							@tap="$refs.showSelectPopup1686823307313.tapHandle(key0),popupShow1686823348321=true,is_tick=false">
							<view
								class='flex flex-wrap align-center self-center justify-center sexRegister_fd0_0_c0_c0_c0'>
								<image v-if="item.image" class='sexRegister_fd0_0_c0_c0_c0_c0' :src='item.image'></image>
								<text class='sexRegister_fd0_0_c0_c0_c0_c1'>{{item.name}}</text>
							</view>
						</view>
						<view v-else class='flex flex' :key="key0"
							@tap="$refs.showSelectPopup1686823307313.tapHandle(key0),popupShow1686823348321=true,is_tick=false">
							<view
								class='flex flex-wrap align-center self-center justify-center sexRegister_fd0_0_c0_c1_c0'>
								<image v-if="item.image" class='sexRegister_fd0_0_c0_c0_c0_c0' mode="aspectFit" :src='item.image'></image>
								<text class='sexRegister_fd0_0_c0_c1_c0_c1'>{{item.name}}</text>
							</view>
						</view>
					</template>
				</benben-select-diy>
			</view>
		</view>

		<!---flex布局flex布局结束-->
		<benben-popup v-model="popupShow1686823348321" :mask="true" mode='center'>
			<!---会员规则flex布局开始-->
			<view class="flex flex-direction flex-wrap align-center benben-flex-layout">
				<view class='flex flex-direction flex-wrap align-center sexRegister_fd1_0'>
					<view class="flex align-center justify-between">
						<text class='sexRegister_fd1_0_c0'>成年人隐私协议</text>
						<image class='sexRegister_fd1_1 ' mode="aspectFit" :src='STATIC_URL+"67.png"'
							@tap.stop="popupShow1686823348321=false,is_tick=false"></image>
					</view>
					<scroll-view scroll-y="true" style="height: 700rpx;">
						<view>
							<jyf-parser :html="parser1 | richTextFormat" style="color: #666666;"></jyf-parser>
						</view>
					</scroll-view>

					<!---会员规则flex布局结束-->
					<view class="flex flex-direction align-center  flex codeLogon_flex_2">
						<view class='flex flex-wrap align-center codeLogon_fd2_0'>
							<benben-flex-switch-new class-name='flex flex codeLogon_fd2_0_c0' v-model="is_tick"
								:disabled='false'>
								<template v-slot:checked>

									<view class='flex flex position-relative align-center'>
										<image class='codeLogon_checkfd2_0_c0_c0_c0' mode="aspectFill"
											:src='STATIC_URL+"1.png"'></image>
									</view>

								</template>
								<template v-slot:unchecked>

									<view class='flex flex position-relative justify-end align-center'>
										<image class='codeLogon_checkfd2_0_c0_c0_c0' mode="aspectFill"
											:src='STATIC_URL+"51.png"'></image>
									</view>
								</template>
							</benben-flex-switch-new>
							<text class='codeLogon_fd2_0_c1'>阅读并同意成年人隐私协议</text>
						</view>
					</view>
					<view class='flex flex-wrap align-center'>
						<button class='login_fd1_3_c0' @tap='changesex()'>确定</button>
					</view>
				</view>
			</view>
		</benben-popup>


	</view>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				"popupShow1686823348321": false,
				"is_tick": false,
				"sexid": "1",
				backimg: '',
				aid: 5,
				parser1: '',
				"sextype": [],
				"sextype_hide": [{
					"name": "女性vip",
					"value": "1",
					"image": "https://zhongben-crm.oss-cn-zhangjiakou.aliyuncs.com/uploads/images/20230510/e081ab319bd1689ca80106e314f84735.png"
				}, {
					"name": "男性vip",
					"value": "2",
					"image": "https://zhongben-crm.oss-cn-zhangjiakou.aliyuncs.com/uploads/images/20230509/04bb06e8692b623311d67f85fe3b9d6e.png"
				}],
				is_hide: 1, // 1隐藏 0显示
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {
			is_tick(newVal) {
				if (newVal) { // 检查 istick 是否为真
					// this.changesex() // 调用函数 a()
				}
			}
		},
		onLoad(options) {
			this.getxieyi()
			let a = uni.getStorageSync('backgound')
			this.backimg = a
			// console.log(this.backimg, 'this.backimg')
			// this.postHide();
			this.sextype = this.sextype_hide;
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			// 是否隐藏三方  post64fabe4eafefc
			postHide() {
				this.$api.post(global.apiUrls.post64fabe4eafefc, {

				}).then(res => {
					// console.log(res);
					if (res.data.code == 1) {
						this.is_hide = res.data.data.is_hide;
						if (this.is_hide == 1) {
							this.sextype = [{
								"name": "注册",
								"value": "2",
								"image": ""
							}];
							this.sexid = 2;
						} else {
							this.sextype = this.sextype_hide;
						}
					}
				})
			},
			//状态赋值
			stateFunc() {
				if (this.sex == '1') {
					this.sex = '2';
				} else {
					this.sex = '1';
				}
			},
			async getxieyi() {
				let res = await this.$api.post(global.apiUrls.xieyi, {
					aid: this.aid
				});
				// console.log(res, 'ressssssss')
				if (res.data.code != 1) {
					this.$message.info(res.data.msg)
					return
				}
				this.parser1 = res.data.data.content
			},
			//获取背景图
			// async getimg() {
			//   let res = await this.$api.post(global.apiUrls.a647dc0f8b7df1);
			//   console.log(res, 'ressssssss')
			//   if (res.data.code != 1) {
			//     this.$message.info(res.data.msg)
			//     return
			//   }
			//   this.backimg = res.data.data.app_bg_img
			//   console.log(this.backimg, 'this.backimg')
			// },
			async changesex() {
				if (this.is_tick === false) {
					this.$message.info('请阅读并同意成年人隐私协议');
					return false;
				}
				this.popupShow1686823348321 = false;
				if (this.sexid == 1) {
					// uni.navigateTo({
					// 	url: '/pages/dlzc/nvxing/nvxing?sex=2'
					// })
					uni.navigateTo({
						url: '/pages/dlzc/registers/registers?sex=2'
					})
				} else if (this.sexid == 2) {
					uni.navigateTo({
						url: '/pages/dlzc/registers/registers?sex=1'
					})
				}
				// else {
				// 	let res = await this.$api.post(global.apiUrls.a6491005922266, {});
				// 	// console.log(res, 'res')
				// 	this.$message.info(res.data.msg)
				// 	this.$store.commit('updateUserInfo', res.data.data.userinfo);
				// 	this.$store.commit('saveToken', res.data.data.userinfo.user_token);
				// 	setTimeout(() => {
				// 		uni.switchTab({
				// 			url: '/pages/tabBar/index/index'
				// 		})
				// 	}, 800)

				// }
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background-size: 100% 100% !important;
	}

	.sexRegister_flex_0 {
		position: relative;
		top: 400rpx;
	}

	.codeLogon_flex_2 {
		overflow: hidden;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
		margin-top: 24rpx;
	}

	.codeLogon_fd2_0 {
		margin: auto 0rpx 32rpx 0rpx;
	}

	.login_fd1_3_c0 {
		background: #6A0002;
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		font-size: 24rpx;
		color: #fff;
		height: 50rpx;
		line-height: 50rpx;
		font-weight: 400;
		width: 338rpx;
	}

	::v-deep .codeLogon_fd2_0_c0 {
		margin: 0rpx 8rpx 0rpx 0rpx;
	}

	.codeLogon_checkfd2_0_c0_c0_c0 {
		width: 34rpx;
		height: 34rpx;
	}

	.codeLogon_fd2_0_c1 {
		line-height: 32rpx;
		font-size: 22rpx;
		font-weight: 400;
		color: rgba(153, 153, 153, 1);
	}

	.codeLogon_fd2_0_c3 {
		line-height: 32rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: rgba(153, 153, 153, 1);
	}

	.codeLogon_fd2_0_c2 {
		line-height: 32rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: var(--benbenFontColor4);
	}

	.sexRegister_fd0_0_c0_c1_c0_c1 {
		color: #222222;
		font-size: 32rpx;
		font-weight: 500;
	}

	.sexRegister_fd0_0_c0_c1_c0 {
		background: #F8F8F8;
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		width: 560rpx;
		height: 88rpx;
		margin: 0rpx 0rpx 80rpx 0rpx;
		box-shadow: 0rpx 4rpx 20rpx 1rpx rgba(106, 0, 2, 0.3);
	}

	.sexRegister_fd0_0_c0_c0_c0_c1 {
		color: #FFFFFF;
		font-size: 32rpx;
		font-weight: 500;
	}

	.sexRegister_fd0_0_c0_c0_c0_c0 {
		width: 32rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.sexRegister_fd0_0_c0_c0_c0 {
		background: #6A0002;
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		width: 560rpx;
		height: 88rpx;
		margin: 0rpx 0rpx 80rpx 0rpx;
	}

	.sexRegister_fd1_1 {
		width: 55rpx;
		height: 55rpx;
		border-radius: 55rpx 55rpx 55rpx 55rpx;
		position: absolute;
		right: 32rpx;
		top: 20rpx;
	}

	.sexRegister_fd1_0_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
		line-height: 48rpx;
	}

	.sexRegister_fd1_0_c0 {
		font-size: 34rpx;
		font-weight: 500;
		color: #333;
		margin: 0rpx 0rpx 16rpx 0rpx;
	}

	.sexRegister_fd1_0 {
		background: #fff;
		width: 640rpx;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		background-size: 100% auto !important;
		padding: 28rpx 32rpx 32rpx 32rpx;
	}
</style>